## HBO Nordic have a REST API but isn't for public use
module Shin
  module Play
    class Hbonordic

      def new
        self
      end

      # Category
      def all(params={})

        # Response
        if params[:offset] != ""
          response = Base.get('https://api-hbon.hbo.clearleap.com/cloffice/client/web/browse/' + params[:id] + '?max=200&offset=' + params[:offset].to_s + '&language=' + params[:language], {local_host: "188.165.139.194"})
        else
          response = Base.get('https://api-hbon.hbo.clearleap.com/cloffice/client/web/browse/' + params[:id] + '?max=10000&offset=0&language=' + params[:language], {local_host: "188.165.139.194"})
        end

        # They place movies in a "entry" tag somehow
        response.parsed_response["rss"]["channel"].to_hashugar
      end

      # Errors
      class NotValid         < StandardError; end
      class MissingArgument  < StandardError; end
      class HTTPError        < StandardError; end
    end
  end
end
